import {FETCH_CITYS,FETCH_DISTRICTS,FETCH_COMMS} from "../actions"
import { createReducer } from 'redux-immutablejs'
import Immutable from 'Immutable'




const initialState = Immutable.fromJS({ citys:[],districts:[],comms:[] })



export default createReducer(initialState,{
  [FETCH_CITYS]:(state,action) => state.set("citys",action.citys),
  [FETCH_DISTRICTS]:(state,action) => state.update("districts",(districts)=>districts.concat(action.districts)),
  [FETCH_COMMS]:(state,action) => state.update("comms",(comms)=>comms.concat(action.comms)),

})
